package exp.day03;

/*
 *  ☆☆☆☆☆☆☆☆
 */
//电子表A+B 题目描述 A+B非常经典，同学们也非常喜欢
// 这不老师也给大家出一个A+B的问题：设电子表格式为24小时制的
// HH:MM:SS 输入一个电子表上的时间A,经过时间B后，电子表上显示的时间是多少呢？
// 输入 多组输入 每一行为一组测试数据包含六个整数 表示两个时间数据A B格式为时分秒
// 输出 每组数据输出A时刻开始B时间段后所对应的时间
// 样例输入 19 45 00 01 30 59 12 00 00 12 31 50 样例输出 21:15:59 00:31:50
import java.util.Scanner;

class Time24 {
    int hour;
    int minute;
    int second;

    public Time24(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
        rationalize();
    }

    private void rationalize() {//实现时间合理化
        int sc = 0;
        sc = second / 60;
        second %= 60;
        minute += sc;
        sc = minute / 60;
        minute %= 60;
        hour += sc;
        hour %= 24;
    }

    public Time24 add(Time24 that) {
        int ch = this.hour + that.hour;
        int cm = this.minute + that.minute;
        int cs = this.second + that.second;
        return new Time24(ch,cm,cs);
    }

    @Override
    public String toString() {
        return String.format("%02d:%02d:%02d",hour,minute,second);
    }
}

public class P04Time24App {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        while (cin.hasNext()) {
            int ah = cin.nextInt(),am = cin.nextInt(),as = cin.nextInt();
            int bh = cin.nextInt(),bm = cin.nextInt(),bs = cin.nextInt();
            Time24 a = new Time24(ah,am,as);
            Time24 b = new Time24(bh,bm,bs);
//            System.out.println(a);
            Time24 c = a.add(b);
            System.out.println(c);
        }

    }
}
